---
title: FileService
summary: Contract detail for FileService, hosted at the `FileService` route.
status: draft
owner: SAIF Doc Gen
last_reviewed: 2026-09-22
---

# FileService

`FileService` implements the external `IFileService` contract and is activated over the `FileService` route. This page documents every public operation the class exposes.

| Field | Value |
| --- | --- |
| **Service class** | `SAIF.Services.WCF.Services.FileService` |
| **Declared contract** | `IFileService` — external (`SAIF.Services.WCF.Contracts`, arriving transitively via `SAIF.Framework.Core`) * |
| **Route** | `FileService` |
| **Source** | `src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs` |
| **Service attributes** | `[AspNetCompatibilityRequirements(RequirementsMode = Allowed)]`, `[LogErrorBehavior]` |
| **Instancing / concurrency** | WCF defaults — not overridden in source |
| **Binding** | `basicHttpBinding` (default, unnamed — no `<endpoint>` is configured for any of the six routes) |
| **Class-level authorization** | None in code |
| **Error handling** | `[LogErrorBehavior]` installs `ErrorLogErrorHandler`; see [Faults and error pipeline](../faults.md) |
| **Operations** | 5 |
| **Also hosted in** | — |

---

## ReadFile

Read a byte range from a caller-supplied path.

| Field | Value |
| --- | --- |
| **Operation name** | `ReadFile` |
| **Contract name** | `ReadFile` — override, if any, not observable because `IFileService` is declared in an external contracts assembly |
| **SOAP action** | Not observable — contract assembly is external |
| **Implementing member** | `SAIF.Services.WCF.Services.FileService.ReadFile` (`src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs`) |
| **Pattern** | Request/response (`IsOneWay` not observable — contract assembly is external) |
| **Binding** | `basicHttpBinding` (default, unnamed) |
| **Authorization** | [None in code](../authentication-authorization.md#authorization-enforcement) |
| **Process** | [OP-001](../operations/file-readfile.md) |

### ReadFile input message

| Part | Type | Required | Default | Purpose |
| --- | --- | --- | --- | --- |
| `path` | `string` | Yes | — | Absolute or relative filesystem path to read; not validated or constrained. |
| `byteLength` | `int` | Yes | — | Number of bytes to allocate and read into the returned buffer. |

### ReadFile output message

| Field | Value |
| --- | --- |
| **Return type** | `byte[]` |
| **Meaning** | The requested byte range from the file at `path`. |
| **Empty-result behavior** | Not applicable — the operation always returns a `byteLength`-sized buffer, zero-padded when the file is shorter. |

### ReadFile faults

| Fault | Declared | Raised when | Surfaced as | Detail crosses the boundary |
| --- | --- | --- | --- | --- |
| Filesystem exception (`IOException`, `UnauthorizedAccessException`, `FileNotFoundException`) | Not declared | See [OP-001 process detail](../operations/file-readfile.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |

<!-- No `[FaultContract]` is declared on any operation in this host — see Faults and error pipeline. -->

### ReadFile authorization

None in code. Access to `ReadFile` rests entirely on the IIS authentication configured for the deployment variant; see [Authentication and authorization](../authentication-authorization.md#authorization-enforcement).

### ReadFile side effects

| Aspect | Finding |
| --- | --- |
| Records written | None |
| Downstream calls | None |
| Files or messages produced | None beyond the file-system read |
| Shared state touched | None |
| Repeat-call behavior | Re-reads the same bytes; no state is mutated |

---

## ReadEntireFile

Read an entire file from a caller-supplied path.

| Field | Value |
| --- | --- |
| **Operation name** | `ReadEntireFile` |
| **Contract name** | `ReadEntireFile` — override, if any, not observable because `IFileService` is declared in an external contracts assembly |
| **SOAP action** | Not observable — contract assembly is external |
| **Implementing member** | `SAIF.Services.WCF.Services.FileService.ReadEntireFile` (`src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs`) |
| **Pattern** | Request/response (`IsOneWay` not observable — contract assembly is external) |
| **Binding** | `basicHttpBinding` (default, unnamed) |
| **Authorization** | [None in code](../authentication-authorization.md#authorization-enforcement) |
| **Process** | [OP-002](../operations/file-readentirefile.md) |

### ReadEntireFile input message

| Part | Type | Required | Default | Purpose |
| --- | --- | --- | --- | --- |
| `path` | `string` | Yes | — | Filesystem path to read in full; not validated or constrained. |

### ReadEntireFile output message

| Field | Value |
| --- | --- |
| **Return type** | `byte[]` |
| **Meaning** | The complete contents of the file at `path`. |
| **Empty-result behavior** | Not applicable — a missing or unreadable file faults rather than returning an empty array. |

### ReadEntireFile faults

| Fault | Declared | Raised when | Surfaced as | Detail crosses the boundary |
| --- | --- | --- | --- | --- |
| Filesystem exception | Not declared | See [OP-002 process detail](../operations/file-readentirefile.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |

<!-- No `[FaultContract]` is declared on any operation in this host — see Faults and error pipeline. -->

### ReadEntireFile authorization

None in code. Access to `ReadEntireFile` rests entirely on the IIS authentication configured for the deployment variant; see [Authentication and authorization](../authentication-authorization.md#authorization-enforcement).

### ReadEntireFile side effects

| Aspect | Finding |
| --- | --- |
| Records written | None |
| Downstream calls | None |
| Files or messages produced | None beyond the file-system read |
| Shared state touched | None |
| Repeat-call behavior | Re-reads the same bytes |

---

## WriteFile

Write bytes to a caller-supplied path.

| Field | Value |
| --- | --- |
| **Operation name** | `WriteFile` |
| **Contract name** | `WriteFile` — override, if any, not observable because `IFileService` is declared in an external contracts assembly |
| **SOAP action** | Not observable — contract assembly is external |
| **Implementing member** | `SAIF.Services.WCF.Services.FileService.WriteFile` (`src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs`) |
| **Pattern** | Request/response (`IsOneWay` not observable — contract assembly is external) |
| **Binding** | `basicHttpBinding` (default, unnamed) |
| **Authorization** | [None in code](../authentication-authorization.md#authorization-enforcement) |
| **Process** | [OP-003](../operations/file-writefile.md) |

### WriteFile input message

| Part | Type | Required | Default | Purpose |
| --- | --- | --- | --- | --- |
| `path` | `string` | Yes | — | Destination filesystem path; not validated or constrained. |
| `bytes` | `byte[]` | Yes | — | Content to write at `path`. |

### WriteFile output message

| Field | Value |
| --- | --- |
| **Return type** | void |
| **Meaning** | A successful response indicates only that the operation completed without a fault. |
| **Empty-result behavior** | Not applicable. |

### WriteFile faults

| Fault | Declared | Raised when | Surfaced as | Detail crosses the boundary |
| --- | --- | --- | --- | --- |
| Filesystem exception | Not declared | See [OP-003 process detail](../operations/file-writefile.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |

<!-- No `[FaultContract]` is declared on any operation in this host — see Faults and error pipeline. -->

### WriteFile authorization

None in code. Access to `WriteFile` rests entirely on the IIS authentication configured for the deployment variant; see [Authentication and authorization](../authentication-authorization.md#authorization-enforcement).

### WriteFile side effects

| Aspect | Finding |
| --- | --- |
| Records written | None |
| Downstream calls | None |
| Files or messages produced | Creates or overwrites the file at `path` |
| Shared state touched | None |
| Repeat-call behavior | Overwrites the target file on every call |

---

## DeleteFile

Delete a file at a caller-supplied path.

| Field | Value |
| --- | --- |
| **Operation name** | `DeleteFile` |
| **Contract name** | `DeleteFile` — override, if any, not observable because `IFileService` is declared in an external contracts assembly |
| **SOAP action** | Not observable — contract assembly is external |
| **Implementing member** | `SAIF.Services.WCF.Services.FileService.DeleteFile` (`src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs`) |
| **Pattern** | Request/response (`IsOneWay` not observable — contract assembly is external) |
| **Binding** | `basicHttpBinding` (default, unnamed) |
| **Authorization** | [None in code](../authentication-authorization.md#authorization-enforcement) |
| **Process** | [OP-004](../operations/file-deletefile.md) |

### DeleteFile input message

| Part | Type | Required | Default | Purpose |
| --- | --- | --- | --- | --- |
| `path` | `string` | Yes | — | Filesystem path to delete; not validated or constrained. |

### DeleteFile output message

| Field | Value |
| --- | --- |
| **Return type** | void |
| **Meaning** | A successful response indicates only that the operation completed without a fault. |
| **Empty-result behavior** | Not applicable. |

### DeleteFile faults

| Fault | Declared | Raised when | Surfaced as | Detail crosses the boundary |
| --- | --- | --- | --- | --- |
| Filesystem exception | Not declared | See [OP-004 process detail](../operations/file-deletefile.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |

<!-- No `[FaultContract]` is declared on any operation in this host — see Faults and error pipeline. -->

### DeleteFile authorization

None in code. Access to `DeleteFile` rests entirely on the IIS authentication configured for the deployment variant; see [Authentication and authorization](../authentication-authorization.md#authorization-enforcement).

### DeleteFile side effects

| Aspect | Finding |
| --- | --- |
| Records written | None |
| Downstream calls | None |
| Files or messages produced | Removes the file at `path` |
| Shared state touched | None |
| Repeat-call behavior | Idempotent for an already-deleted path |

---

## Length

Report the length of a caller-supplied path.

| Field | Value |
| --- | --- |
| **Operation name** | `Length` |
| **Contract name** | `Length` — override, if any, not observable because `IFileService` is declared in an external contracts assembly |
| **SOAP action** | Not observable — contract assembly is external |
| **Implementing member** | `SAIF.Services.WCF.Services.FileService.Length` (`src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs`) |
| **Pattern** | Request/response (`IsOneWay` not observable — contract assembly is external) |
| **Binding** | `basicHttpBinding` (default, unnamed) |
| **Authorization** | [None in code](../authentication-authorization.md#authorization-enforcement) |
| **Process** | [OP-005](../operations/file-length.md) |

### Length input message

| Part | Type | Required | Default | Purpose |
| --- | --- | --- | --- | --- |
| `path` | `string` | Yes | — | Filesystem path to measure; not validated or constrained. |

### Length output message

| Field | Value |
| --- | --- |
| **Return type** | `long` |
| **Meaning** | The length, in bytes, of the file at `path`. |
| **Empty-result behavior** | Not applicable — a missing file faults rather than returning zero. |

### Length faults

| Fault | Declared | Raised when | Surfaced as | Detail crosses the boundary |
| --- | --- | --- | --- | --- |
| Filesystem exception | Not declared | See [OP-005 process detail](../operations/file-length.md) | Generic SOAP fault produced by The `ErrorLogErrorHandler` installed by `[LogErrorBehavior]` | Yes |

<!-- No `[FaultContract]` is declared on any operation in this host — see Faults and error pipeline. -->

### Length authorization

None in code. Access to `Length` rests entirely on the IIS authentication configured for the deployment variant; see [Authentication and authorization](../authentication-authorization.md#authorization-enforcement).

### Length side effects

| Aspect | Finding |
| --- | --- |
| Records written | None |
| Downstream calls | None |
| Files or messages produced | None beyond the file-system read |
| Shared state touched | None |
| Repeat-call behavior | Idempotent read |


---

## Coverage checklist

| Public member | Documented section | Pattern |
| --- | --- | --- |
| `byte[] ReadFile(string path, int byteLength)` | [`ReadFile`](#readfile) | Request/response |
| `byte[] ReadEntireFile(string path)` | [`ReadEntireFile`](#readentirefile) | Request/response |
| `void WriteFile(string path, byte[] bytes)` | [`WriteFile`](#writefile) | Request/response |
| `void DeleteFile(string path)` | [`DeleteFile`](#deletefile) | Request/response |
| `long Length(string path)` | [`Length`](#length) | Request/response |

## Related documentation
- [Index](../index.md)
- [Overview](../overview.md)
- [Architecture](../architecture.md)
- [Activation and hosting](../activation-hosting.md)
- [Operations](../operations.md)
- [Faults and error pipeline](../faults.md)
- [Authentication and authorization](../authentication-authorization.md)
- [Dependencies](../dependencies.md)
- [Configuration](../configuration.md)
- [Operations and processes](../operations-processes.md)
- [Business rules](../business-rules.md)
- [Data model](../data-model.md)
- [Operational runbook](../operational-runbook.md)
- [Tech debt](../tech-debt.md)

> **Note:** Statements marked with `*` were inferred from code structure, naming
> conventions, or contextual evidence where direct confirmation was not available
> in source artifacts. Statements marked with `**` could not be confirmed; treat
> as unknown until verified.

## Sources
- src/WCF/SAIF.Services.WCF.Host/Services/FileService.cs
